package com.example.music_mediaplayer.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

import com.example.music_mediaplayer.R;
import com.example.music_mediaplayer.adapter.MyListViewAdapter;
import com.example.music_mediaplayer.globalvariable.GlobalVariable;



public class XiaMiFragment extends Fragment {
    private View rootView;
    private ListView listView;
    private MyListViewAdapter adapter;
    //    private OkHttpTools okHttpTools = new OkHttpTools();
    private Intent intent;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (rootView == null){
            rootView = inflater.inflate(R.layout.fragment_xiami,null);
        }
        initView(rootView);
        return rootView;
    }

    public void initView(View rootView){
//        okHttpTools.getSongUrlById(getActivity(),"song",GlobalVariable.songList.get(0).getId());
        listView = (ListView) rootView.findViewById(R.id.song_list);
        adapter = new MyListViewAdapter(getActivity(), GlobalVariable.XiaMiSongList,2);
//        LogoutT.logout(GlobalVariable.XiaMiSongList.size()+"zzzzz");
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {

            }
        });
    }
}
